package com.itcast.rpc.core.server.initializer;

import com.itcast.rpc.core.base.RpcRequest;
import com.itcast.rpc.core.codec.RpcDecoder;
import com.itcast.rpc.core.codec.RpcEncoder;
import com.itcast.rpc.core.server.handler.ServerRpcHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;

/**
 * @program: bio_tcp
 * @description:
 * @author: zhanghz001
 * @create: 2021-02-23 14:24
 **/
public class ServiceInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        socketChannel.pipeline()
                .addLast(new RpcDecoder<>(RpcRequest.class))
                .addLast(new RpcEncoder())
                .addLast(new ServerRpcHandler())
        ;
    }
}
